package com.yangchoi.jetpackcompose.ui.widget.component

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.yangchoi.jetpackcompose.theme.white_16sp
import com.yangchoi.jetpackcompose.ui.widget.ext.onClick


/**
 * lazy row 的item
 * 底部的space宽度根据上面的title所占用的宽度确定
 *
 * 1.将box的宽度设置为width(IntrinsicSize.Max)
 */
//@Composable
//fun RowItemWithSpaceWidthByTitle(selectIndex:Int,
//                                 itemIndex:Int,
//                                 item
//){
//    Box(modifier = Modifier
//        .padding(end = 16.dp)
//        .width(IntrinsicSize.Max)
//        .onClick { onItemClick.invoke(index, item) }) {
//        Text(text = "${item.title}", style = white_16sp.copy(fontSize = 18.sp))
//        Spacer(
//            modifier = Modifier
//                .padding(start = 5.dp, end = 5.dp, top = 26.dp)
//                .fillMaxWidth()
//                .height(2.dp)
//                .background(
//                    color = if (selectIndex == itemIndex) cFFC300 else Color.Black,
//                    shape = RoundedCornerShape(2.dp)
//                )
//        )
//    }
//}